package Test04;

import Test04.ProductItem;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.Random;

public class Test4 {
    public static void main(String[] args) {
        ArrayList<ProductItem>productItems=new ArrayList<>();
        Random rd=new Random();
        productItems.add(new ProductItem(1, rd.nextInt(100000000), 1, "酸奶", 50));
        productItems.add(new ProductItem(2, rd.nextInt(100000000), 2, "手机", 5000));
        productItems.add(new ProductItem(3, rd.nextInt(100000000), 3, "手机壳", 45));
        productItems.add(new ProductItem(4, rd.nextInt(100000000), 4, "漱口水", 35));
        Iterator<ProductItem> iterator = productItems.iterator();
        while (iterator.hasNext()){
            ProductItem p= iterator.next();
            System.out.println(p.toString());
        }
    }
}
